import * as regExp from "./regular";

//表單中必须輸入汉字
export function validateNeedName(rule, value, callback) {
  const name = regExp.name;
  if (name.test(value)) {
    callback();
  } else {
    return callback(new Error("請輸入汉字"));
  }
}

//表單中輸入手機號驗證
export function validateMobile(rule, value, callback) {
  const mobile = regExp.mobile;
  if (mobile.test(value)) {
    callback();
  } else {
    return callback(new Error("手機號輸入错误！"));
  }
}
